import request from '@/utils/request.js'

export default {
	/* 添加购物车 */
	reqAddShopCart(data){
		return request.post('/api/add_cart', data)
	},
	/* 获取购物车列表 */
	reqShopCartList(data){
		return request.post('/api/get_cart_list', data)
	},
	/* 更改checked选中*/
	reqChangeChecked(data){
		return request.post('/api/toggle_check_cart',data)
	},
	/* 取消选中和选中 */
	reqAllChangeCart(data){
		let { _id, checked } =  data
		return request.post(`/api/${ checked ?'cancel':'check'}_cart`,{ _id })
	},
	/* 购物车加减 */
	reqAddOrReduce(data) {
		return request.post('/api/change_cart_num', data)
	},
	/* 移除购物车 */
	reqRemoveCart(data){
		return request.post('/api/remove_cart', data)
	}
}